<div id="ps0">
	<div class="personcenterPage clearfix">
	{include file="public/left" /}
	<!-- start -->
		<div class="main_box">
			<div>
				<div class="step_panel">
					<div class="step on">
						1.填写课程信息
					</div>
					<div class="step">
						2.上传课程内容
					</div>
				</div>
			</div>
			<div class="main_cont my-form">
				<form action="" method="post" enctype="multipart/form-data">
					<div class="form_group">
						<div class="label">
							课程名称
						</div>
						<div class="form_ctl">
							<input type="text" placeholder="请输入课程名称" name="course_name" class="form_input">
						</div>
					</div>
					<div class="form_group">
						<div class="label">
							课程分类
						</div>
						<div class="form_ctl">
							<select name="subject_id" id="" class="form_input_min">
								<option value="0">--请选择--</option>
								{foreach $subject as $k=>$v }
								<option value="{$v.id}" style="padding-left:20px;">{$v.subject_name}</option>
								{/foreach}
							</select>
							<!----><!---->
						</div>
					</div>
					<div class="form_group">
						<div class="label">
							课程介绍
						</div>
						<div class="form_ctl">
							<div id="introduce">
									<!-- introduce -->
							</div>
							<textarea id="introduce1" name="introduce" style="display:none;"></textarea>
						</div>
					</div>
					<div class="form_group">
						<div class="label">
							是否免费
						</div>
						<div class="form_ctl form_ctl_radio">
							<input name="is_free" type="radio" value="1" checked=""><label>免费</label>
							<input name="is_free" type="radio" value="0" ><label >付费</label>
						</div>
					</div>
					<div class="form_group">
						<div class="label">
							难度
						</div>
						<div class="form_ctl form_ctl_radio">
							<input name="course_level" type="radio" value="1" checked=""><label for="">基础</label>
							<input name="course_level" type="radio" value="2"><label for="">进阶</label>
							<input name="course_level" type="radio" value="3"><label for="">提高</label>
						</div>
					</div>
					<!---->
					<div class="form_group">
						<div class="label">
							课程售价
						</div>
						<div class="form_ctl">
							<input type="text" name="original_price" placeholder="请输入价格" class="form_input" style="width:120px;margin-right:10px;"><span>元</span>
						</div>
					</div>
					<div class="form_group">
						<div class="label">
							上传封面
						</div>
						<div class="form_ctl upload_ctl">
							<input type="hidden" name="course_logo">
							<div class="preview"></div>
							<div class="upload_com">
								<button type="button" class="layui-btn layui-btn-primary" id="test1">
								  <i class="layui-icon">&#xe67c;</i>上传图片
								</button>
							</div>
						</div>
					</div>
					<div class="form_group">
						<div class="label">
						</div>
						<div class="form_ctl">
								<button type="submit" class="layui-btn layui-btn-my" style="width:200px;">确认</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	<!-- end -->
	</div>
</div>
<script type="text/javascript">
window.onload=function(){
	element.on('tab(docDemoTabBrief)', function(data){
	});
}
</script>
<script>
layui.use(['upload','layer'], function(){
  var upload = layui.upload;
  var layer = layui.layer;
   
  //执行实例
  var uploadInst = upload.render({
    elem: '#test1' //绑定元素
    ,accept:'images'
    ,field:'logo'
    ,url: '{:url("index/upload/cover")}' //上传接口
    ,done: function(res){
      //上传完毕回调
      if(res.code==0){
		$('.preview').html('<img src="'+res.data[0].src+'" alt="">');
		$(" input[ name='course_logo' ] ").val(res.data[0].src);
      }else{
      	layer.msg(res.msg);
      }
    }
    ,error: function(){
      //请求异常回调
    }
  });
});
</script>
<script type="text/javascript" src="/static/plug/wangeditor/wangEditor.min.js"></script>
<script type="text/javascript">
	var E = window.wangEditor
	var editor = new E('#introduce')
	// 或者 var editor = new E( document.getElementById('editor') )
	editor.customConfig.uploadFileName = 'course_introduce';
    editor.customConfig.uploadImgServer = "{:url('index/upload/course')}";
    // 隐藏“网络图片”tab
    // editor.customConfig.showLinkImg = false
    var $text1 = $('#introduce1')
    editor.customConfig.onchange = function (html) {
        // 监控变化，同步更新到 textarea
        $text1.val(html)
    }
    // 限制一次最多能传几张图片
    editor.customConfig.uploadImgMaxLength = 1;
	editor.create()

    // 配置服务器端地址
	
</script>
   